package com.young.weixin.model.message;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.young.weixin.model.enums.EWxMessageTypeEnum;

/**
 * 定位消息
 *
 * @author wangjiyu
 * @date 2021/10/5 17:05
 */
@XStreamAlias("xml")
public class WxLocationMessage extends WxBaseMessage {
    /**
     * 地理位置纬度
     */
    @XStreamAlias("Location_X")
    private String locationX;
    /**
     * 地理位置经度
     */
    @XStreamAlias("Location_Y")
    private String locationY;
    /**
     * 地理位置信息
     */
    @XStreamAlias("Label")
    private String label;
    /**
     * 地图缩放大小
     */
    @XStreamAlias("Scale")
    private String scale;

    /**
     * 构造消息对象
     *
     * @param fromUser 发送人
     * @param toUser   接收人
     * @return 消息对象
     */
    @Override
    public WxLocationMessage build(String fromUser, String toUser) {
        WxLocationMessage message = new WxLocationMessage();
        message.fillWxBaseMessage(fromUser, toUser, EWxMessageTypeEnum.LOCATION);
        return message;
    }

    /**
     * 构造消息对象
     *
     * @param messageMapWrapper 参数map
     * @return 消息对象
     */
    @Override
    public WxLocationMessage convert(WxMessageMapWrapper messageMapWrapper) {
        WxLocationMessage message = new WxLocationMessage();
        message.fillWxBaseMessage(messageMapWrapper);
        message.setLocationX(messageMapWrapper.getLocationX());
        message.setLocationY(messageMapWrapper.getLocationY());
        message.setLabel(messageMapWrapper.getLabel());
        message.setScale(messageMapWrapper.getScale());
        return message;
    }

    public WxLocationMessage() {
        super();
    }

    public String getLocationX() {
        return locationX;
    }

    public void setLocationX(String locationX) {
        this.locationX = locationX;
    }

    public String getLocationY() {
        return locationY;
    }

    public void setLocationY(String locationY) {
        this.locationY = locationY;
    }

    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public String getScale() {
        return scale;
    }

    public void setScale(String scale) {
        this.scale = scale;
    }
}
